package com.ccc.scala.base11_generic

object Generic02 {
  def main(args: Array[String]): Unit = {
    // 泛型协变
    val test1: Test[User] = new Test[User] // OK
    // val test2 : Test[User] = new Test[Parent] // Error
    val test3: Test[User] = new Test[SubUser] // OK

  }

  class Test[+T] {
  }

  class Parent {
  }

  class User extends Parent {
  }

  class SubUser extends User {
  }

}
